<table>
  <tr>
    <th>Hostname</th>
    <th>IP</th>
    <th>Groups</th>
    <th>Elasticsearch roles</th>
  </tr>
{% for host in groups['all'] | sort %}
  <tr>
    <td>{{ host }}</td>
    <td>{{ hostvars[host]['ansible_host'] }}</td>
    <td style="text-align: left;">{{ hostvars[host]['group_names'] | sort | join(', ') }}</td>
    <td style="text-align: left;">
      {{ hostvars[host].elasticsearch_config['node.roles'] | sort | join(', ') }}
    </td>
 </tr>
{% endfor %}
</table>
